<?php
namespace src\logic;
use \classlib\core as C;
class lexplore {
	//获取资料信息列表
	public static function get_list($userid, $start, $limit, $sorts, $where=array()) {
		$filter = array('isshow'=>1, 'status'=>1, array('neartime', 0, \classlib\orm::OP_GT));
		$where  = array_merge($where, $filter);
		$field  = 'id,userid,olstatus,airtime,title,lasttime,neartime,studiono,thumb,lv,exp,starlv';
		$list   = C\model::load('main.pl.studio')->get_list($start, $limit, $where, $field, $sorts);
		if ($list) {
			$uorm = C\model::load('main.pl.userinfo');
			$xfans= ($userid > 0)? luser::myfocus($userid):array();
			foreach ($list as &$item) {
				$user  = $uorm->set_dev($item['userid'])->get_one($item['userid']);
				$item['nickname'] = $user['nickname'];
				$item['avtar']    = $user['thumb'];
				$item['lvicon']   = lv::icon($user['lv'], 0);
				$item['canfocus'] = ($item['userid'] == $userid)? 0:1;
				$item['link']     = C\router::get_url('index', 'linkto', array('sid'=>$item['id']));
				$item['isfocus']  = in_array($item['userid'], $xfans)? 1:0;
				$item['starlv']   = lstudio::grade($item['starlv']);
			}
		} else {
			$list = array();
		}
		return $list;
	}
}